package com.woniuxy.project115.kaer.platform.mapper;

import com.woniuxy.project115.kaer.platform.entity.Permission;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;


/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author fyy
 * @since 2025年02月23日
 */
@Mapper
public interface PermissionMapper extends BaseMapper<Permission> {
    @Select("SELECT p.permission " +
            "FROM role r " +
            "JOIN role_permission rp ON r.id = rp.role_id " +
            "JOIN permission p ON rp.permission_id = p.id " +
            "WHERE r.id = #{roleId};")
    List<String> selectPermissionsByRoleId(Integer roleId);
}
